import { BaseService, Service, Permission } from '@/cool';

@Service('crm/taobao')
export default class extends BaseService {
	@Permission('getLink')
	async getLink() {
		// 浏览器弹窗防止拦截
		let win = window.open();
		const url = await this.request({
			url: '/getLink',
			params: {
				type: 'web'
			}
		});
		win.location = url;

		return true;
	}

	@Permission('pageauthorize')
	async pageauthorize(params) {
		return this.request({
			url: '/pageauthorize',
			params: {
				...params
			}
		});
	}

	@Permission('fetchOrder')
	async fetchOrder(params) {
		return this.request({
			url: '/fetchOrder',
			params: {
				...params
			}
		});
	}
	@Permission('tkl')
	async tkl(params) {
		return this.request({
			url: '/tkl',
			params: {
				...params
			}
		});
	}
	@Permission('shortUrl')
	async shortUrl(params) {
		return this.request({
			url: '/shortUrl',
			params: {
				...params
			}
		});
	}
}
